function paging(url, div) {	
	var redirect = window.location.href;
	$.getJSON(				
		url + '&callback=?',
		{redirect:redirect},
		function(response) {					
			if(response['error'] == 0) {					
				$('#'+div).html(response['data']);				
				if(response['redirect_l'] != "" && response['redirect_l'] != undefined) {
					$.getScript(response['redirect_l']);
				    history.pushState(null, document.title, response['redirect_l']);				   
				}
			} else {
				alert(response['msg']);
			}
		}
	);	
}
function showUIMessage(msg) {
	if (msg!="") {
		$.blockUI({
			message: msg, 
			css: {
				background:'#e0f0e0', 
				color:'#303030', 
				border:'1px solid #389010',				
				showOverlay: false, 
				width:'400px', 
				top: (($(window).height()-400)/2) + 'px', 
				left:(($(window).width()-400)/2) + 'px', 
				padding:'10px',
				textAlign:'center',
				zIndex:10000
			}, 
			overlayCSS: {
				opacity:'0',
				textAlign:'left',
				zIndex:3000
			}
		});
		$('.blockOverlay').click($.unblockUI);
		setTimeout($.unblockUI, 1*20*60);
	}
}
function closeUI() {
	$.unblockUI();	
}
validateCaptcha = function (pinput) {
	var result = false; 
	if (pinput.length == 8 && pinput != "") {
		var strUrl = HOST_FRONTEND + 'valid/isvalidcaptcha';
		$.ajax({
			cache	: false,
			async	: false,
			type	: 'POST',
			data	: 'input='+pinput,
			url		: strUrl,
			success	: function(response) {
				result = (response == 1 ? true : false);
			}
		});
	}
	return result;
}
refreshCaptcha = function (pcontainer, psession) {
	if (psession == undefined) psession = '';
	var strUrl = HOST_FRONTEND + 'ajax/refreshcaptcha';
	$.ajax({
		cache	: false,
		async	: false,
		type	: 'POST',
		data	: 'container='+pcontainer + '&session='+psession,
		url		: strUrl,
		success	: function(response) {			
			$('#'+pcontainer).html(response);			
		}
	});
}
validateDate = function(txtDate)
{
    var currVal = txtDate;
    if(currVal == '')
        return false;
    
    var rxDatePattern = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/; //Declare Regex
    var dtArray = currVal.match(rxDatePattern); // is format OK?
    
    if (dtArray == null)
        return false;
    
    //Checks for mm/dd/yyyy format.
    dtMonth = dtArray[1];
    dtDay= dtArray[3];
    dtYear = dtArray[5];        
    
    if (dtMonth < 1 || dtMonth > 12)
        return false;
    else if (dtDay < 1 || dtDay> 31)
        return false;
    else if ((dtMonth==4 || dtMonth==6 || dtMonth==9 || dtMonth==11) && dtDay ==31)
        return false;
    else if (dtMonth == 2)
    {
        var isleap = (dtYear % 4 == 0 && (dtYear % 100 != 0 || dtYear % 400 == 0));
        if (dtDay> 29 || (dtDay ==29 && !isleap))
                return false;
    }
    return true;
}
checkDate = function(year, month, day){
	year 	= parseInt(year);
	month 	= parseInt(month);
	day 	= parseInt(day);
	var d = new Date(year, month, day);	
  	return d.getFullYear() == year && 
         d.getMonth() == month &&
         d.getDate() == day;
}
function checkDate(strDate, isShowMessage, strMessage1, strMessage2, strMessage3, strMessage4) 
{
	if(strMessage1 == undefined) strMessage1 = 'Ngày/tháng/năm bạn nhập không hợp lệ.' + "\n\n" + 'Bạn nhớ lưu ý kiểm tra năm nhuần.';
	if(strMessage2 == undefined) strMessage2 = 'Năm bạn nhập phải lớn hơn 1900.';
	if(strMessage3 == undefined) strMessage3 = 'Định dạng ngày tháng cho phép: DD/MM/YYYY' + "\n\n" + 'Bạn vui lòng kiểm tra lại dữ liệu đã nhập.';
	if(strMessage4 == undefined) strMessage4 = 'Ngày bạn nhập phải lớn hơn hoặc bằng ngày hiện tại.';
	if(isShowMessage == undefined) isShowMessage = 1;
 /**gia tri nhap vao phai la dd/mm/yyyy*/
	var arrayDATE;
    var dtest;
   	arrayDATE = strDate.split("/"); 	
	if((arrayDATE[0] != undefined && arrayDATE[0].length < 2) || (arrayDATE[1] != undefined && arrayDATE[1].length < 2) || ( arrayDATE[2] != undefined && arrayDATE[2].length < 4) || arrayDATE.length == 1) {
		if(isShowMessage)
			alert(strMessage3); 
		return false;
	}
	/** ngay cua he thong la mm/dd/yyyy nen phai doi ra ngay he thong */
	var dtest 	= new Date(arrayDATE[1] + "/" + arrayDATE[0] + "/" + arrayDATE[2]);   
	var today 	= new Date();
	
    if (dtest.getDate() != arrayDATE[0] || dtest.getMonth() +1 != arrayDATE[1] || dtest.getFullYear() != arrayDATE[2]) 
	{
    	if(isShowMessage) 
			alert(strMessage1);
		return false;
    }	
	if(dtest < today) {
		if(isShowMessage) 
			alert(strMessage4);
		return false;
	}
	if (arrayDATE[2]<=1900) 
	{
	   /**neu nam nho hon 1900 thi se ko insert duoc vao sql server*/
		if(isShowMessage) 
			alert(strMessage2);
		return false;
	}
	return 1;
}
validateUsername = function(strUserName) {
	/**
	* Length: 5-30
	* Định dạng:
		- Cho phép nhập ký tự, chữ số và _
		- Bắt đầu bằng ký tự a-z|A-Z
		- Dấu _ phải nằm giữa 2 chuỗi
	*/
	var alphaExp = /^(([A-Za-z\d][A-Za-z\d_]{4,29}[a-zA-Z\d])|([a-zA-Z\d]{5,30}))$/;
	if(strUserName.match(alphaExp)){
		return true;
	}
	return false;
}
validateCode = function(str) {	
	var alphaExp = /^([a-zA-Z]{2,50})$/;
	if(str.match(alphaExp)){
		return true;
	}
	return false;
}
validateMobile = function (strMobile) {
	/**
		* Định dạng:
		- 09xxxxxxxx
		- 01xxxxxxxxx
	*/
	var alphaExp = /^((09[\d]{8})|(^01[\d]{9}))$/;
	if(strMobile.match(alphaExp)) {
		return true;
	}
	return false;
}
validateImage = function(strFilename) {
  	var ext = (strFilename.substring(strFilename.length-4, strFilename.length)).toLowerCase();
  	ext = ext.replace('.', '');
  	if( ext != 'jpg' && ext != 'gif' && ext != 'png' && ext != 'jpeg' ) return false;
  	return true;
}
validateImgSize = function(strId,maxImgSize) {	
	if($.browser.msie)
	{
		try {
			if (window.ActiveXObject) { 
				var objFSO 	= new ActiveXObject("Scripting.FileSystemObject");
				var sPath 	= $("#" + strId)[0].value;
				var objFile = objFSO.getFile(sPath);
				var intSize = objFile.size;
			} else {				
				alert('Vui lòng cài đặt ActionXObject để sử dụng tính năng Đăng ảnh trên website.');
				return true;
			}
		} catch (e) {
			console.log(e.description);
			return true;
		}
	}
	else {
		intSize = $("#"+strId)[0].files[0].size; 			
	}
	intSize = ((intSize/1024)/1024);	
	if(maxImgSize == undefined)	maxImgSize=1;
	if(intSize > maxImgSize || intSize == 0) {
		return false;
	}
	return true;
}
validateObjectFlash = function(strLink) {
	var pattern = '<object[^>]*?.*?</object>';	
	if(strLink.match(pattern)) {
		return true;
	}
	return false;
}

function isNumberKey(evt){
	var charCode = (window.event) ? event.keyCode : evt.which;
	if (charCode > 31 && (charCode < 48 || charCode > 57))
		return false;
	return true;
}
function filterStr(inputString, filterString){
	var outString = "";	
	for(var i=0; i<inputString.length; i++){
		if(filterString.indexOf(inputString.substr(i,1) )!=-1)
			outString = outString + inputString.substr(i,1);
	}	
	return outString;
}
function addPointer(intValue, evt){
	if(!isNumberKey(evt)) return;
	var strTemp  = "";
	var isCont 	 = true;
	var strValue = intValue.value;	
		
	strValue = filterStr(strValue, '0123456789');
	while(isCont){
		if(strValue.charAt(0) == '0'){
			strValue = strValue.substr(1,strValue.length);
		}
		else isCont = false;
	}
	for(var i=strValue.length-1; i>=0; i--){
		strTemp = strValue.charAt(i) + strTemp;		
		if ( (((i-strValue.length)%3)==0) && (i!=0)){
			strTemp= '.' + strTemp;
		}
	}	
	intValue.value = strTemp;
}
function addPointerByValue(intValue) {
	if(intValue > 0) {
    	return intValue.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");
	} else {
		return 0;
	}
}
function checkPointKey(e){
	var keyCode //= (window.event) ? event.keyCode : e.which;   
	if (window.event) keyCode = event.keyCode   
	else keyCode = e.which   
	// Was key that was pressed a numeric character (0-9) or , or <- or -> or backspace (8) or tab (9)?   
	if ( keyCode > 47 && keyCode < 58 || keyCode == 46 || keyCode == 37 || keyCode == 39 || keyCode == 8 || keyCode == 9) {
		flagProcessPoint = true;
		return; // if so, do nothing   else // otherwise, discard character   
	}
	flagProcessPoint = false;
	if (window.event) //IE       
		window.event.returnValue = null;     
	else //Firefox       
		e.preventDefault(); 
	 
}
// Replaces all instances of the given substring.
// The substring you want to replace
// The string you want to replace in.
replaceAll = function(strText, strTarget,strSubString){
	var intIndexOfMatch = strText.indexOf( strTarget );	 
	// Keep looping while an instance of the target string
	// still exists in the string.
	while (intIndexOfMatch != -1){
		// Relace out the current instance.
		strText = strText.replace( strTarget, strSubString )
		 
		// Get the index of any next matching substring.
		intIndexOfMatch = strText.indexOf( strTarget );
	}	 
	// Return the updated string with ALL the target strings
	// replaced out with the new substring.
	return( strText );
}
/***/
checkOneItem = function(formName, chkCheckAll){
	var i;
	var flag;
	flag=1;
	for(i=0;i<formName.length; i++)
	{
		var elm  = formName.elements[i];
		if(elm.type == "checkbox" && elm.name != chkCheckAll )
		{
			if(elm.checked==false)
			{
				flag=0;
			}
		}
	}
	if(flag==1)
	{
		$('#' + chkCheckAll).attr('checked',true);
	}
	else
	{
		$('#' + chkCheckAll).attr('checked',false);
	}
}
checkAll = function(formName, strName, strValue) {
	for( i=0 ; i < formName.length ; i++)
		if( formName.elements[i].type == 'checkbox' && formName.elements[i].name == strName )
			formName.elements[i].checked = strValue;
			
}
function stripTags(str,option) {
	if(option == undefined) option = 0;
    str = str.replace(/&nbsp;/g,'');
	str = str.replace(/\[(B|\/B|b|\/b|I|\/I|i|\/i|U|\/U|u|\/u)\]/g,'');
	str = jQuery.trim(str);
	if(option == 0) { // comment
		allowed_tags = '<a>,<img>,' + "\n";
	}
	else if( option == 1 ) { // form create - edit	
		allowed_tags = '<p>,<font>,<span>,<a>,<img>,<h1>,<h2>,<h3>,<h4>,<h5>,<h6>,<strong>,<b>,<em>,<i>,<u>,' + "\n";
		allowed_tags += ',<sub>,<sup>,<video>,<iframe>,<object>,<param>,<embed>,<ul>,<ol>,<li>';
	} else if( option == 2) {
		allowed_tags = '<object>,<param>,<embed>';
	} else if(option == 3) {
		var alphaExp = /^\[(quote|QUOTE)(.*)\](.*)\[\/(quote|QUOTE)\](.*)$/;
		var arrExp	 = str.match(alphaExp);
		if(arrExp) { str = arrExp[5]; }		
		allowed_tags = '<p>,<strong>,<b>,<em>,<i>,<u>,<span>,<a>,<img>,<br/>,<br>' + "\n";
	} else if(option == 4) {
		allowed_tags = "\n";
	} else {
		allowed_tags = '';
	}
	var key = '', allowed = false;
    var matches = [];
    var allowed_array = [];
    var allowed_tag = '';
    var i = 0;
    var k = '';
    var html = '';
    var replacer = function(search, replace, str) {
        return str.split(search).join(replace);
    };
    // Build allowes tags associative array
    if (allowed_tags) {
        allowed_array = allowed_tags.match(/([a-zA-Z]+)/gi);
    }
    str += '';
    // Match tags
    matches = str.match(/(<\/?[\S][^>]*>)/gi);
    // Go through all HTML tags
    for (key in matches) {
        if (isNaN(key)) {
            // IE7 Hack
            continue;
        }
        // Save HTML tag
        html = matches[key].toString();
        // Is tag not in allowed list? Remove from str!
        allowed = false;
        // Go through all allowed tags
        for (k in allowed_array) {
            // Init
            allowed_tag = allowed_array[k];
            i = -1;
            if (i != 0) { i = html.toLowerCase().indexOf('<'+allowed_tag+'>');}
            if (i != 0) { i = html.toLowerCase().indexOf('<'+allowed_tag+' ');}
            if (i != 0) { i = html.toLowerCase().indexOf('</'+allowed_tag)   ;}

            // Determine
            if (i == 0) {
                allowed = true;
                break;
            }
        }
        if (!allowed) {
            str = replacer(html, "", str); // Custom replace. No regexing
        }
    }
    return str;
}
function insertWord(word, idinput, defaults) {				
	var field 	= document.getElementById(idinput);	
	$('#emo_'+idinput).show();	
	if(defaults != '') {
		if(field.value.toLowerCase() == defaults.toLowerCase()) {
			field.value = '';
			$("textarea#"+idinput).css("min-height","30px");
			$("textarea#"+idinput).css("color","#000");
		}		
	}
	var word 	= word + ' '; 
	if (document.selection) {
		field.focus();
		var sel = document.selection.createRange();
		sel.text = word;
		sel.select();
		
	} else if (field.selectionStart || field.selectionStart == '0') {	
		resize(field,30);
		var start = field.selectionStart;
		var end = field.selectionEnd;
		//var scroll = field.scrollTop;
		field.value = field.value.substring(0, start) + word + field.value.substring(end, field.value.length);
		field.focus();
		field.selectionStart = start + word.length;
		field.selectionEnd = start + word.length;
		//field.scrollTop = scroll;
		
	} else {
		field.value += word;
		field.focus();
	}
	
};
function resize(ele,minH) {   
	ele.style.height = 'auto';  
    var newHeight = (ele.scrollHeight > minH ? Math.round(ele.scrollHeight + 2.5) : minH); 
	ele.style.height = newHeight.toString() + 'px';
	ele.style.padding_bottom = '3px';
}
function get_html_translation_table (table, quote_style) {
    // Returns the internal translation table used by htmlspecialchars and htmlentities  
    // 
    // version: 1109.2015
    // discuss at: http://phpjs.org/functions/get_html_translation_table    // +   original by: Philip Peterson
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: noname
    // +   bugfixed by: Alex
    // +   bugfixed by: Marco    // +   bugfixed by: madipta
    // +   improved by: KELAN
    // +   improved by: Brett Zamir (http://brett-zamir.me)
    // +   bugfixed by: Brett Zamir (http://brett-zamir.me)
    // +      input by: Frank Forte    // +   bugfixed by: T.Wild
    // +      input by: Ratheous
    // %          note: It has been decided that we're not going to add global
    // %          note: dependencies to php.js, meaning the constants are not
    // %          note: real constants, but strings instead. Integers are also supported if someone    // %          note: chooses to create the constants themselves.
    // *     example 1: get_html_translation_table('HTML_SPECIALCHARS');
    // *     returns 1: {'"': '&quot;', '&': '&amp;', '<': '&lt;', '>': '&gt;'}
    var entities = {},
        hash_map = {},        decimal;
    var constMappingTable = {},
        constMappingQuoteStyle = {};
    var useTable = {},
        useQuoteStyle = {}; 
    // Translate arguments
    constMappingTable[0] = 'HTML_SPECIALCHARS';
    constMappingTable[1] = 'HTML_ENTITIES';
    constMappingQuoteStyle[0] = 'ENT_NOQUOTES';    constMappingQuoteStyle[2] = 'ENT_COMPAT';
    constMappingQuoteStyle[3] = 'ENT_QUOTES';
 
    useTable = !isNaN(table) ? constMappingTable[table] : table ? table.toUpperCase() : 'HTML_SPECIALCHARS';
    useQuoteStyle = !isNaN(quote_style) ? constMappingQuoteStyle[quote_style] : quote_style ? quote_style.toUpperCase() : 'ENT_COMPAT'; 
    if (useTable !== 'HTML_SPECIALCHARS' && useTable !== 'HTML_ENTITIES') {
        throw new Error("Table: " + useTable + ' not supported');
        // return false;
    } 
    entities['38'] = '&amp;';
    if (useTable === 'HTML_ENTITIES') {
        entities['160'] = '&nbsp;';
        entities['161'] = '&iexcl;';        entities['162'] = '&cent;';
        entities['163'] = '&pound;';
        entities['164'] = '&curren;';
        entities['165'] = '&yen;';
        entities['166'] = '&brvbar;';        entities['167'] = '&sect;';
        entities['168'] = '&uml;';
        entities['169'] = '&copy;';
        entities['170'] = '&ordf;';
        entities['171'] = '&laquo;';        entities['172'] = '&not;';
        entities['173'] = '&shy;';
        entities['174'] = '&reg;';
        entities['175'] = '&macr;';
        entities['176'] = '&deg;';        entities['177'] = '&plusmn;';
        entities['178'] = '&sup2;';
        entities['179'] = '&sup3;';
        entities['180'] = '&acute;';
        entities['181'] = '&micro;';        entities['182'] = '&para;';
        entities['183'] = '&middot;';
        entities['184'] = '&cedil;';
        entities['185'] = '&sup1;';
        entities['186'] = '&ordm;';        entities['187'] = '&raquo;';
        entities['188'] = '&frac14;';
        entities['189'] = '&frac12;';
        entities['190'] = '&frac34;';
        entities['191'] = '&iquest;';        entities['192'] = '&Agrave;';
        entities['193'] = '&Aacute;';
        entities['194'] = '&Acirc;';
        entities['195'] = '&Atilde;';
        entities['196'] = '&Auml;';        entities['197'] = '&Aring;';
        entities['198'] = '&AElig;';
        entities['199'] = '&Ccedil;';
        entities['200'] = '&Egrave;';
        entities['201'] = '&Eacute;';        entities['202'] = '&Ecirc;';
        entities['203'] = '&Euml;';
        entities['204'] = '&Igrave;';
        entities['205'] = '&Iacute;';
        entities['206'] = '&Icirc;';        entities['207'] = '&Iuml;';
        entities['208'] = '&ETH;';
        entities['209'] = '&Ntilde;';
        entities['210'] = '&Ograve;';
        entities['211'] = '&Oacute;';        entities['212'] = '&Ocirc;';
        entities['213'] = '&Otilde;';
        entities['214'] = '&Ouml;';
        entities['215'] = '&times;';
        entities['216'] = '&Oslash;';        entities['217'] = '&Ugrave;';
        entities['218'] = '&Uacute;';
        entities['219'] = '&Ucirc;';
        entities['220'] = '&Uuml;';
        entities['221'] = '&Yacute;';        entities['222'] = '&THORN;';
        entities['223'] = '&szlig;';
        entities['224'] = '&agrave;';
        entities['225'] = '&aacute;';
        entities['226'] = '&acirc;';        entities['227'] = '&atilde;';
        entities['228'] = '&auml;';
        entities['229'] = '&aring;';
        entities['230'] = '&aelig;';
        entities['231'] = '&ccedil;';        entities['232'] = '&egrave;';
        entities['233'] = '&eacute;';
        entities['234'] = '&ecirc;';
        entities['235'] = '&euml;';
        entities['236'] = '&igrave;';        entities['237'] = '&iacute;';
        entities['238'] = '&icirc;';
        entities['239'] = '&iuml;';
        entities['240'] = '&eth;';
        entities['241'] = '&ntilde;';        entities['242'] = '&ograve;';
        entities['243'] = '&oacute;';
        entities['244'] = '&ocirc;';
        entities['245'] = '&otilde;';
        entities['246'] = '&ouml;';        entities['247'] = '&divide;';
        entities['248'] = '&oslash;';
        entities['249'] = '&ugrave;';
        entities['250'] = '&uacute;';
        entities['251'] = '&ucirc;';        entities['252'] = '&uuml;';
        entities['253'] = '&yacute;';
        entities['254'] = '&thorn;';
        entities['255'] = '&yuml;';
    } 
    if (useQuoteStyle !== 'ENT_NOQUOTES') {
        entities['34'] = '&quot;';
    }
    if (useQuoteStyle === 'ENT_QUOTES') {        entities['39'] = '&#39;';
    }
    entities['60'] = '&lt;';
    entities['62'] = '&gt;';
  
    // ascii decimals to real symbols
    for (decimal in entities) {
        if (entities.hasOwnProperty(decimal)) {
            hash_map[String.fromCharCode(decimal)] = entities[decimal];        }
    }
 
    return hash_map;
}
function html_entity_decode (string, quote_style) {
    // Convert all HTML entities to their applicable characters  
    // 
    // version: 1109.2015
    // discuss at: http://phpjs.org/functions/html_entity_decode    // +   original by: john (http://www.jd-tech.net)
    // +      input by: ger
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: Onno Marsman    // +   improved by: marc andreu
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +      input by: Ratheous
    // +   bugfixed by: Brett Zamir (http://brett-zamir.me)
    // +      input by: Nick Kolosov (http://sammy.ru)    // +   bugfixed by: Fox
    // -    depends on: get_html_translation_table
    // *     example 1: html_entity_decode('Kevin &amp; van Zonneveld');
    // *     returns 1: 'Kevin & van Zonneveld'
    // *     example 2: html_entity_decode('&amp;lt;');    // *     returns 2: '&lt;'
    var hash_map = {},
        symbol = '',
        tmp_str = '',
        entity = '';    
	tmp_str = string.toString();
 
    if (false === (hash_map = this.get_html_translation_table('HTML_ENTITIES', quote_style))) {
        return false;
    } 
    // fix &amp; problem
    // http://phpjs.org/functions/get_html_translation_table:416#comment_97660
    delete(hash_map['&']);
    hash_map['&'] = '&amp;'; 
    for (symbol in hash_map) {
        entity = hash_map[symbol];
        tmp_str = tmp_str.split(entity).join(symbol);
    }    tmp_str = tmp_str.split('&#039;').join("'");
 
    return tmp_str;
}
/**********************************************************************************************************************************************************/
/***** ADMIN ************/
/**********************************************************************************************************************************************************/

function cancelSearch(formName) {
	$('#pcancel').val(1);
	formName.reset();
	formName.submit();
}
function confirmActive(formName){
	for(i=0;i < formName.length;i++){
		if(formName.elements[i].type=='checkbox' && formName.elements[i].checked == true) {
			selected = true;
			break;
		} else {
			selected = false;
		}
	}
	if( !selected ) {
		alert(DATA_UNCHECK);
		return false;
	} else {		
		formName.paction.value = 1;			
		formName.submit();	
		return true;
	}
}
function confirmDelete(formName){
	for(i=0;i < formName.length;i++){
		if(formName.elements[i].type=='checkbox' && formName.elements[i].checked == true) {
			selected = true;
			break;
		} else {
			selected = false;
		}
	}
	if( !selected ) {
		alert(DATA_UNCHECK);
		return false;
	} else {
		if ( confirm(DATA_DELETE) == true ) {				
			formName.paction.value = 2;	
			formName.submit();			
			return true;
		} else {
			return false;
		}
	}
}
function confirmPending(formName){
	for(i=0;i < formName.length;i++){
		if(formName.elements[i].type=='checkbox' && formName.elements[i].checked == true) {
			selected = true;
			break;
		} else {
			selected = false;
		}
	}
	if( !selected ) {
		alert(DATA_UNCHECK);
		return false;
	} else {		
		formName.paction.value = 3;
		formName.submit();	
		return true;
	}
}
function confirmDeleteDb(formName){
	for(i=0;i < formName.length;i++){
		if(formName.elements[i].type=='checkbox' && formName.elements[i].checked == true) {
			selected = true;
			break;
		} else {
			selected = false;
		}
	}
	if( !selected ) {
		alert(DATA_UNCHECK);
		return false;
	} else {
		if ( confirm(DATA_DELETE_DB) == true ) {				
			formName.paction.value = 4;	
			formName.submit();			
			return true;
		} else {
			return false;
		}
	}
}
function act(formName, intValue){
	for(i=0;i < formName.length;i++){
		if(formName.elements[i].type=='checkbox' && formName.elements[i].checked == true) {
			selected = true;
			break;
		} else {
			selected = false;
		}
	}
	if( !selected ) {
		alert(DATA_UNCHECK);
		return false;
	} else {		
		formName.paction.value = intValue;
		formName.submit();	
		return true;
	}
}
function validateUrl(value){
      return /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
}